<template>
  <div class="app-main-container">
    <div class="app-main-title">
      商户详情
      <div class="goback" @click="$router.replace(`/merchant/merchantAdmin`)">
        <i class="el-icon-refresh-left" /> 返回上一页
      </div>
    </div>
    <div class="dialog_wrap">
      <div class="title">商户信息</div>
      <div class="wrap">
        <div class="item">
          <span class="key">商户名称：</span>
          <span class="value">{{ detail.shopName }}</span>
        </div>
        <div class="item">
          <span class="key">商户类型：</span>
          <span class="value">{{ detail.shopTypeName }}</span>
        </div>
        <div class="item">
          <span class="key">企业名称：</span>
          <span class="value">{{ detail.enterpriseName }}</span>
        </div>
        <div class="item">
          <span class="key">企业信用代码：</span>
          <span class="value">{{ detail.enterpriseCode }}</span>
        </div>
        <div class="item">
          <span class="key">联系人：</span>
          <span class="value">{{ detail.userInfo }}</span>
        </div>
        <div class="item">
          <span class="key">联系邮箱：</span>
          <span class="value">{{ detail.email }}</span>
        </div>
        <div class="item">
          <span class="key">地址：</span>
          <span class="value">{{ detail.addr }}</span>
        </div>
        <div class="item">
          <span class="key">法人：</span>
          <span class="value">{{ detail.juridicalName }}</span>
        </div>
        <div class="item">
          <span class="key">法人微信号：</span>
          <span class="value">{{ detail.juridicalWx }}</span>
        </div>
        <div class="item">
          <span class="key">备注：</span>
          <span class="value">{{ detail.remark }}</span>
        </div>
        <div class="item">
          <span class="key">创建时间：</span>
          <span class="value">{{ detail.createTime }}</span>
        </div>
      </div>
      <div class="title">部署信息</div>
      <div class="wrap">
        <div class="item">
          <span class="key">数据库链接地址：</span>
          <span class="value">{{ detail.dbUrl }}</span>
        </div>
        <div class="item">
          <span class="key">账号：</span>
          <span class="value">{{ detail.dbUserName }}</span>
        </div>
        <div class="item">
          <span class="key">密码：</span>
          <span class="value">{{ detail.dbPassword }}</span>
        </div>
      </div>
      <div class="title">小程序信息</div>
      <el-table
        :data="detail.miniProDate"
        border
        fit
        :header-row-class-name="'table-header'"
        class="doumee-element-table"
      >
        <el-table-column
          align="center"
          label="小程序编码"
          prop="proCode"
          min-width="120"
          show-overflow-tooltip
        />
        <el-table-column
          align="center"
          label="小程序名称"
          prop="appName"
          min-width="120"
          show-overflow-tooltip
        />
        <el-table-column
          align="center"
          label="APPID"
          prop="appId"
          min-width="120"
          show-overflow-tooltip
        />
        <el-table-column
          align="center"
          label="小程序类型"
          prop="appType"
          min-width="120"
          show-overflow-tooltip
        >
          <template slot-scope="scope">
            <span>{{ scope.row.appType == "1" ? "运营端" : "会员端" }}</span>
          </template>
        </el-table-column>
        <el-table-column
          align="center"
          label="小程序状态"
          prop="authStatus"
          min-width="120"
          show-overflow-tooltip
        >
          <template slot-scope="scope">
            <span>{{ scope.row.authStatus == "0" ? "注册中" : scope.row.authStatus == "1" ? "注册成功" : "注册失败" }}</span>
          </template>
        </el-table-column>
        <el-table-column
          align="center"
          label="ext_json"
          prop="extJson"
          min-width="120"
          show-overflow-tooltip
        />
        <el-table-column
          align="center"
          label="最新版本号"
          prop="newV"
          min-width="120"
          show-overflow-tooltip
        />
        <el-table-column
          align="center"
          label="上个版本号"
          prop="beforeV"
          min-width="120"
          show-overflow-tooltip
        />
        <el-table-column
          align="center"
          label="授权状态"
          prop="authStatus"
          min-width="120"
          show-overflow-tooltip
        >
          <template slot-scope="scope">
            <span>{{ scope.row.authStatus == "1" ? "已授权" : "未授权" }}</span>
          </template>
        </el-table-column>
        <el-table-column
          align="center"
          label="创建时间"
          prop="createTime"
          min-width="160"
          show-overflow-tooltip
        />
      </el-table>
      <div class="mt30" />
    </div>
  </div>
</template>

<script>
import { shopInfo } from '@/api'
export default {
  data() {
    return {
      isShow: false,
      detail: {}
    }
  },
  created() {
    this.getDetail()
  },
  methods: {
    getDetail() {
      shopInfo({
        param: { shopId: this.$route.query.shopId }
      }).then((res) => {
        if (res.errorCode !== '000000') return
        this.detail = res.record
      })
    }
  }
}
</script>

<style lang="scss" scoped>
  .dialog_wrap{
    .title{
      font-size: 16px;
      font-weight: 800;
      margin: 20px 0px;
    }
    .wrap{
      display: flex;
      flex-wrap: wrap;
      .item{
        width: 50%;
        margin-bottom: 10px;
      }
    }
  }
</style>
